package com.cloudwise.controller;


import com.cloudwise.entity.ReturnBean;
import com.cloudwise.entity.Student;
import com.cloudwise.service.StudentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author 张燕豪
 * @description 学生报名管理
 * @author makejava
 * @since 2022-01-21 16:19:09
 */
@RestController
@RequestMapping("student")
public class StudentController extends BaseController {
    @Resource
    private StudentService studentService;

    @PostMapping("insert")
    public ReturnBean insert(@RequestBody Student student){
        System.out.println("---------------------------------------------");
        student.setStatus(0);
        student.setFlag("0");
        System.out.println(student.toString());
        boolean save = this.studentService.insert(student);
        if (save) {
            return super.success(save,1L);
        } else {
            return super.fail(save,1L);
        }
    }

    @GetMapping("{idCard}")
    public ReturnBean selectOne(@PathVariable String idCard){
        Student student = studentService.selectOne(idCard);
        return super.success(student);
    }

}
